function cancel_req(id) {
  if(!confirm('Cancel edition ?')) return;
  new Ajax.Request("/requirements/req/"+id,{onComplete:function(r){$("req_"+id).replace(r.responseText)}, asynchronous:true, evalScripts:true});
  }

function update_req(id,response) {
  if(response.status!=200) {
    alert(response.responseText);
    return;
    }
  el = $("req_"+id);  
  el.replace(response.responseText);
  new Effect.Highlight("req_"+id, {duration:3});
  }

function edit_req(id) {
  new Ajax.Request("/requirements/edit/"+id,{parameters: Form.serialize("req_"+id), onComplete:function(r){update_req(id,r)}, asynchronous:true, evalScripts:true});
  }

